import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class MaxsalarySortFlowbean implements WritableComparable<MaxsalarySortFlowbean> {
    private String jd_sub_type;//招聘岗位类型
    private long max_salary;//最高工资
    private String min_edu_level;//最低学历水平
    public MaxsalarySortFlowbean(){
        super();
    }

    //比较
    public int compareTo(MaxsalarySortFlowbean bean) {

        int result;
        if((max_salary>bean.getMax_salary())){
            result=-1;
        }else if ((max_salary <bean.getMax_salary())){
            result=1;
        }else {
            result=0;
        }
      return  result;
    }
    //1.序列化
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeUTF(jd_sub_type);
        dataOutput.writeLong(max_salary);
        dataOutput.writeUTF(min_edu_level);
    }
    //反序列化
    public void readFields(DataInput dataInput) throws IOException {
        jd_sub_type= dataInput.readUTF();
        max_salary=dataInput.readLong();
        min_edu_level=dataInput.readUTF();
    }

    public String getJd_sub_type() {
        return jd_sub_type;
    }

    public void setJd_sub_type(String jd_sub_type) {
        this.jd_sub_type = jd_sub_type;
    }

    public long getMax_salary() {
        return max_salary;
    }

    public void setMax_salary(long max_salary) {
        this.max_salary = max_salary;
    }

    public String getMin_edu_level() {
        return min_edu_level;
    }

    public void setMin_edu_level(String min_edu_level) {
        this.min_edu_level = min_edu_level;
    }

    @Override
    public String toString() {
        return jd_sub_type + "\t" +max_salary + "\t" + min_edu_level ;
    }
}
